import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: HomeView,
    //以下LoginView将显示在HomeView的rout-view中
    children:[
      {
        path: '/login',
        component: () => import( '../views/LoginView.vue')
      },
      {
        path:'/sys-admin/index',
        component: () => import( '../views/sys-admin/AdminIndexView.vue')
      },
      {
        path: '/sys-admin/category/list',
        component: () => import('../views/sys-admin/category/CategoryList')
      },
      {
        path:'/sys-admin/category/add-category',
        component: () => import('../views/sys-admin/category/AddCategory.vue')
      },
      {
        path:'/sys-admin/book/list',
        component: () => import('../views/sys-admin/book/BookList.vue')
      },
      {
        path:'/sys-admin/book/add-book',
        component: () => import('../views/sys-admin/book/AddBook.vue')
      },
      {
        path:'/sys-admin/user/list',
        component: () => import('../views/sys-admin/user/UserList')
      },
      {
        path:'/sys-admin/user/management',
        component: () => import('../views/sys-admin/user/ManageUser')
      },
      {
        path:'/sys-admin/borrow/list',
        component: () => import('../views/sys-admin/borrow/BookBorrowed')
      },


    ]
  },

  {
    path: '/about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/sys-admin/AdminIndexView.vue')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
